home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmiSoft / Dev / Gui / Cit.lha / CIT / Demo / FileReqTest.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2003-02-15  |  1.8 KB  |  93 lines

  1. #include "CITGroup.h"
  2. #include "CITButton.h"
  3. #include "CITFileRequest.h"
  4.  
  5. CITApp Application;
  6.  
  7. CITScreen DemoScreen;
  8. CITWindow DemoWindow;
  9. CITVGroup group;
  10. CITButton quitButton;
  11. CITButton fileReqButton;
  12.  
  13. void closeEvent();
  14. void fileReqEvent(ULONG ID,ULONG eventFlag);
  15. void quitEvent(ULONG ID,ULONG eventFlag);
  16.  
  17. int main(void)
  18. {
  19.   BOOL Error=FALSE;
  20.  
  21.   DemoScreen.Display("Workbench");
  22.   DemoScreen.InsObject(DemoWindow,Error);
  23.     DemoWindow.Position(30,30);
  24.     DemoWindow.CloseGadget();
  25.     DemoWindow.DragBar();
  26.     DemoWindow.DepthGadget();
  27.     DemoWindow.Activate();
  28.     DemoWindow.SizeGadget();
  29.     DemoWindow.IconifyGadget();
  30.     DemoWindow.Caption("CITGadgets");
  31.     DemoWindow.CloseEventHandler(closeEvent);
  32.     DemoWindow.InsObject(group,Error);
  33.       group.BevelStyle();
  34.       group.InsObject(fileReqButton,Error);
  35.         fileReqButton.Text("Select file..");
  36.         fileReqButton.EventHandler(fileReqEvent);
  37.       group.InsObject(quitButton,Error);
  38.         quitButton.Text("Quit");
  39.         quitButton.EventHandler(quitEvent);
  40.  
  41.  
  42.   Application.InsObject(DemoScreen,Error);
  43.  
  44.   if( Error )
  45.     return 10;
  46.   else
  47.   {
  48.     Application.Run();
  49.     return 0;
  50.   }
  51. }
  52.  
  53. void closeEvent()
  54. {
  55.   Application.Stop();
  56. }
  57.  
  58. void quitEvent(ULONG ID,ULONG eventFlag)
  59. {
  60.   Application.Stop();
  61. }
  62.  
  63. void fileReqEvent(ULONG ID,ULONG eventFlag)
  64. {
  65.   CITFileRequest frWd;
  66.  
  67.   BOOL Error = FALSE;
  68.  
  69.   frWd.Position(100,100);
  70.   frWd.Size(250,120);
  71.   frWd.CloseGadget();
  72.   //frWd.SaveRequest();
  73.   //frWd.DirRequest();
  74.   frWd.FullPath("Sys:Devs/printer.device");
  75.   frWd.Pattern("#?.device");
  76.  
  77.   DemoScreen.InsObject(frWd,Error);
  78.  
  79.   if( !Error )
  80.   {
  81.     UWORD  retval;
  82.  
  83.     retval = Application.Run(MAIN_STOPMASK|POPUP_CLOSE|POPUP_ACCEPT|POPUP_CANCEL);
  84.  
  85.     if( retval & POPUP_ACCEPT )
  86.     {
  87.       // Do something
  88.     }
  89.   }
  90.  
  91.   DemoScreen.RemObject(frWd);
  92. }
  93.